# nums = [1,2,2]
nums=[4,4,4,1,4]
def dfs(nums,numLen,path,ans,index):
    #递归出口
    if index==numLen:
        if path not in ans:
            ans.append(path[:])
        return None
    dfs(nums,numLen,path,ans,index+1)
    path.append(nums[index])
    dfs(nums,numLen,path,ans,index+1)
    path.pop(len(path)-1)




def subsetsWithDup(nums):
    ans=[]
    numLen=len(nums)
    nums.sort()
    print(nums)
    dfs(nums,numLen,[],ans,0)
    return ans

print(subsetsWithDup(nums))
